package org.jeecg.modules.wangyue.payment.alipay.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConstants;
import com.alipay.api.CertAlipayRequest;
import com.alipay.api.DefaultAlipayClient;
import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Data
@Component("alipayConfig")
@Configuration
/**
 * 支付宝正式环境
 */
public class AlipayConfig {

    /**
     * 商户appid
     */
    private String appId = "2021004109628541";

    /**
     * 商户PID,卖家支付宝账号ID
     */
    private String sellerId = "2088641495488322";

    /**
     * 私钥 pkcs8格式的,rsc中的私钥
     */
    private String privateKey = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCoLN3syrV0CmLymRARD64iMZTi8a2KtdxF8JiqRO9V5ncXk66P3WezdZ2dubGrkfXZw8A6gNq34mFsBQfgi5/eDUoWBZ7mXSow6LYWtTDeqQIMFIvuADYMGiQ9/PwHdxigtPn6KawdpxGqWeVlytsUAUcxwodKJ8lZOPlT6kSfCdtpJ6dLLyDT/g0+2EiRcbimj4G5GnXwJ/RIfbq6P6uJwg7tVeGhNgR6AEhyeVC0ga8bri9yvWqQ0xfFJ2XEctlYEhpaVYhrnyAdWD44Af/GB4s076NWag+cDO9kylNGBAaqY7dn4vGb6Xl39lc6YQpVVgaZ7zDLt7SVr4yDv1W1AgMBAAECggEBAJ1h15GopiThL3YevcVpqik/wziauTBtPqWJIiV9+4ik8+BxiVQC+/Aa6pTXWajZIH1ZToSxX33kcg1Xq+Z8Y/C2+RUgz3J/z2MT9IvNpt1IxqytccIaGno64J3OKcGGt9p1Yta0tujNF6AXHrGjJGBVTd4IUPmZwDkqM1JPk0ZMuN2kk41bAvQpPsO8XNOxsaiFIlUG75m3RHLIXglGMDqlzzvjM2moYZAu+LwcJM5vDzxRSPsWl7pJsHI04JBN09lxUi0LGZFgXc5iQtLR2lucZgpfa7N4GiPv9iQ7aT5Zne4Das/T5iPBXk64r1wTkhve5qIp7TCWYEsLcdnwyyECgYEA6tQhnwwmrk4qmspDYhKu959y5C3WWqiPOrAULNpApsQcoaF3iuMorKoE/nMoT9quO8VHDG4xfOXUlrtTC00XjSlkWl53caK695xcjsP1tQ2kI723MOyb521IAY2S0kGLrltPw3WdcUm1vqfHf+1hTOHhEQ81uXZ/v8Ts2XEO9M0CgYEAt1ZecDBySbqUy2nNvIIH80dOQh1NnMtSjuLUFNlpp93CeHre9JGdpepRWKKtdZjmGxiXTvo/LBIhKqot5pSqUxw0HFigdM7RlkZNw3FOl5NU965LooQJNp7iZ/GqZLBkcRq7z00ZuleWs23M1V6CbwKPiq1SLnKAYqNBgy2XpIkCgYA4xmL+lix/9gwc8owKGSROYDGh82cg8iH2+X1XPslkyIN3nJdPcA50eILOlj8H14JKly7PVZEHdnXIn6+7Sr9H9Nr7cl2EjuiPVzGVntE4Hf0yWvsAjCRBds1y+qylww0ncZI+WqBfNIgJeX0lc9oTgYUt37SIi5rlXZI6HDiWfQKBgHnc9QUJjs4nMURMXa6RmAtDOGeF5tLz6zqC14nMQgiMxPkkYxKZv/pK2CtcZoQmT71vCRQ8DsWSf21GlSARbW2074Zv+qfp2TJUJNhmdmEWU4IW3rt1nFIsJj4FSseG4By2MmRG0XUlR0yZDXA+U+DKCPOa5WduQJxP+/nf0k5RAoGASwdqYo4w7ZAVrLtBDlTmCYn8hSLmAh7ACJTQ6ZXxSkhJVWW99scSTxQvvopmNA4yRRJLWWcas6F4bZEpKaH5QFHgdtdZyV5L2ksu9jxtkNbWMbOXYjKGopJf1wWwNLm0vQ5Idtg7LtyCu37UhvNN4ser6RwOQshI/4etEg9GPTM=";

    /**
     * 支付宝公钥
     */
    //private String publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqCzd7Mq1dApi8pkQEQ+uIjGU4vGtirXcRfCYqkTvVeZ3F5Ouj91ns3Wdnbmxq5H12cPAOoDat+JhbAUH4Iuf3g1KFgWe5l0qMOi2FrUw3qkCDBSL7gA2DBokPfz8B3cYoLT5+imsHacRqlnlZcrbFAFHMcKHSifJWTj5U+pEnwnbaSenSy8g0/4NPthIkXG4po+BuRp18Cf0SH26uj+ricIO7VXhoTYEegBIcnlQtIGvG64vcr1qkNMXxSdlxHLZWBIaWlWIa58gHVg+OAH/xgeLNO+jVmoPnAzvZMpTRgQGqmO3Z+Lxm+l5d/ZXOmEKVVYGme8wy7e0la+Mg79VtQIDAQAB";
    private String publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqPkUgjmMnFYwYsgvmEn08taYmiYDclMF94e/WzizgtmjINZ2JLbjOFiidiHb64maGBWP6QPcIbLFshV/GE0xmDlxJPZdvy6TzD5kdSCMkVMgB4vMiI6uOjgJHaCdKetrQJjamaNL/6vIgPKg+FE03lw7pFtKGeVKkUEU0iVZ/r3/xwDI8L3FwaoU4e74F2OaFCmiOnqDRl16Q4lfhU8ctMo+dNISFAC6FlfNPhxjbg8QAj+0RBivmS5FTA4YuNxA+S9Slv/hmX4uvACXwKeOE/VA9FJ0NOH04UrAtYCVX/Y2kFuGyhasVZqXuMOfVzhXAIfrBO9ZU5bjAW3CpU4+YwIDAQAB";

    /**
     * 请求网关地址
     */
    private String serverUrl = "https://openapi.alipay.com/gateway.do";

    /**
     * 页面跳转同步通知（可以直接返回前端页面、或者通过后端进行跳转）
     */
    private String returnUrl = "https://52iu931038.yicp.fun/wangyue/app/payment/alipay/return";

    /**
     * 服务器异步通知
     */
    private String notifyUrl = "http://www.bangchenwangluo.cn:8080/wangyue/app2/payment/alipay/notify";

    /**
     * 应用公钥证书
     */
    //private String appCertPath = "/src/main/java/org/jeecg/modules/wangyue/payment/zhenshu/alipay/appCertPublicKey_2021004109628541.crt";
    //private String appCertPath = "/zhengshu/alipay/appCertPublicKey_2021004109628541.crt";

    /**
     * 支付宝公钥证书
     */
    //private String alipayCertPath = "/src/main/java/org/jeecg/modules/wangyue/payment/zhenshu/alipay/alipayCertPublicKey_RSA2.crt";
    //private String alipayCertPath = "/zhenshu/alipay/alipayCertPublicKey_RSA2.crt";

    /**
     * 支付宝根证书
     */
    //private String alipayRootCertPath = "/src/main/java/org/jeecg/modules/wangyue/payment/zhenshu/alipay/alipayRootCert.crt";
    //private String alipayRootCertPath = "/zhenshu/alipay/alipayRootCert.crt";

    /**
     * 绝对地址
     */
    //private String url = System.getProperty("user.dir");



    /**
     * 获得初始化的AlipayClient 公钥证书模式
     */
    @Bean
    public AlipayClient alipayClient() {
        try {
            // 获得初始化的AlipayClient 公钥证书模式
            CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
            certAlipayRequest.setServerUrl(serverUrl);
            certAlipayRequest.setAppId(appId);
            certAlipayRequest.setPrivateKey(privateKey);
            certAlipayRequest.setFormat(AlipayConstants.FORMAT_JSON);
            certAlipayRequest.setCharset(AlipayConstants.CHARSET_UTF8);
            certAlipayRequest.setSignType(AlipayConstants.SIGN_TYPE_RSA2);
            // 应用公钥证书
            certAlipayRequest.setCertContent("-----BEGIN CERTIFICATE-----\n" +
                    "MIIEsTCCA5mgAwIBAgIQICMICc51i6XrdEPjy98YnDANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE\n" +
                    "BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0\n" +
                    "aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs\n" +
                    "YXNzIDEgUjEwHhcNMjMwODA5MDIwMTQ1WhcNMjgwODA3MDIwMTQ1WjB5MQswCQYDVQQGEwJDTjEt\n" +
                    "MCsGA1UECgwk6ZmV6KW/6YKm5a64572R57uc56eR5oqA5pyJ6ZmQ5YWs5Y+4MQ8wDQYDVQQLDAZB\n" +
                    "bGlwYXkxKjAoBgNVBAMMITIwODg2NDE0OTU0ODgzMjItMjAyMTAwNDEwOTYyODU0MTCCASIwDQYJ\n" +
                    "KoZIhvcNAQEBBQADggEPADCCAQoCggEBAKgs3ezKtXQKYvKZEBEPriIxlOLxrYq13EXwmKpE71Xm\n" +
                    "dxeTro/dZ7N1nZ25sauR9dnDwDqA2rfiYWwFB+CLn94NShYFnuZdKjDotha1MN6pAgwUi+4ANgwa\n" +
                    "JD38/Ad3GKC0+foprB2nEapZ5WXK2xQBRzHCh0onyVk4+VPqRJ8J22knp0svINP+DT7YSJFxuKaP\n" +
                    "gbkadfAn9Eh9uro/q4nCDu1V4aE2BHoASHJ5ULSBrxuuL3K9apDTF8UnZcRy2VgSGlpViGufIB1Y\n" +
                    "PjgB/8YHizTvo1ZqD5wM72TKU0YEBqpjt2fi8ZvpeXf2VzphClVWBpnvMMu3tJWvjIO/VbUCAwEA\n" +
                    "AaOCASkwggElMB8GA1UdIwQYMBaAFHEH4gRhFuTl8mXrMQ/J4PQ8mtWRMB0GA1UdDgQWBBQK6sRP\n" +
                    "Grjan+oiZXVgRmtSUC9ELzBABgNVHSAEOTA3MDUGB2CBHAFuAQEwKjAoBggrBgEFBQcCARYcaHR0\n" +
                    "cDovL2NhLmFsaXBheS5jb20vY3BzLnBkZjAOBgNVHQ8BAf8EBAMCBsAwLwYDVR0fBCgwJjAkoCKg\n" +
                    "IIYeaHR0cDovL2NhLmFsaXBheS5jb20vY3JsODAuY3JsMGAGCCsGAQUFBwEBBFQwUjAoBggrBgEF\n" +
                    "BQcwAoYcaHR0cDovL2NhLmFsaXBheS5jb20vY2E2LmNlcjAmBggrBgEFBQcwAYYaaHR0cDovL2Nh\n" +
                    "LmFsaXBheS5jb206ODM0MC8wDQYJKoZIhvcNAQELBQADggEBADEMYlk/SCtLWoAQ/8+H8ytJY4WQ\n" +
                    "lqbsZL2QmhFPgyOBhZmg2DBmOcJNfoHUGQ7ZHU90wL9VQh9305uNJzgsrnCRqzfdNPU1UbuK/u4b\n" +
                    "HjYUm8aijuzj0opPhhZJQut8qr0mTgQg2wbkoNL1zoasC7JsWodgj958WikLLGEO3nnPT6T0VokL\n" +
                    "i8aakpa8trg1NtgZPIRl6dqjDV9qqU04/noy7G3HK090aDElISfttyOWa1gVGZybl6FzvmpaCMka\n" +
                    "dyRBGUF86cW2V+NeDqoBfYzxa7lDetnOQaVfJGKjgdrtSN55pHCfdMMaUKct8nvOA1DExW2D1l94\n" +
                    "whFmQVALVJs=\n" +
                    "-----END CERTIFICATE-----");

            // 支付宝公钥证书
            certAlipayRequest.setAlipayPublicCertContent("-----BEGIN CERTIFICATE-----\n" +
                    "MIIDnTCCAoWgAwIBAgIQICMICbiiCq5MosisLqpNDzANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UE\n" +
                    "BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0\n" +
                    "aG9yaXR5MTkwNwYDVQQDDDBBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IENs\n" +
                    "YXNzIDIgUjEwHhcNMjMwODA5MDIwMTQ2WhcNMjgwODA3MDIwMTQ2WjB+MQswCQYDVQQGEwJDTjEZ\n" +
                    "MBcGA1UECgwQMjA4ODY0MTQ5NTQ4ODMyMjEPMA0GA1UECwwGQWxpcGF5MUMwQQYDVQQDDDrmlK/k\n" +
                    "u5jlrp0o5Lit5Zu9Kee9kee7nOaKgOacr+aciemZkOWFrOWPuC0yMDg4NjQxNDk1NDg4MzIyMIIB\n" +
                    "IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqPkUgjmMnFYwYsgvmEn08taYmiYDclMF94e/\n" +
                    "WzizgtmjINZ2JLbjOFiidiHb64maGBWP6QPcIbLFshV/GE0xmDlxJPZdvy6TzD5kdSCMkVMgB4vM\n" +
                    "iI6uOjgJHaCdKetrQJjamaNL/6vIgPKg+FE03lw7pFtKGeVKkUEU0iVZ/r3/xwDI8L3FwaoU4e74\n" +
                    "F2OaFCmiOnqDRl16Q4lfhU8ctMo+dNISFAC6FlfNPhxjbg8QAj+0RBivmS5FTA4YuNxA+S9Slv/h\n" +
                    "mX4uvACXwKeOE/VA9FJ0NOH04UrAtYCVX/Y2kFuGyhasVZqXuMOfVzhXAIfrBO9ZU5bjAW3CpU4+\n" +
                    "YwIDAQABoxIwEDAOBgNVHQ8BAf8EBAMCA/gwDQYJKoZIhvcNAQELBQADggEBAHSCj6KaAIj7gOpB\n" +
                    "tRvWingVcOD6J+k2Tg6YrT23/8j/mllPdNapgWJn2ShH3UQsQMwcBTSZ4mBmWUwv0+DDKLCfUbZk\n" +
                    "1ACy02x3bUKWNA6ToeROP6X7j0Q+G1FYWxByjaOhldaGz+zjZrBP6i5e9E5FJlPfdUWbEO9LeU7B\n" +
                    "YV2uQi817uJ2DEsIB1v9AuF1W76wsBbfsYVCDbEYDHVg6CpttROzg1lNfYuvXB+YQ5Ct7QVYWLNy\n" +
                    "a9TVR29QeMn4N/pAFEkYkenOB5Chw93quFhjuzqJjBjA2ggucTHFQ1eHHZz3qFFP/UmgJBDVGj4m\n" +
                    "Ner4nOHfOEah6XxWCy14R5c=\n" +
                    "-----END CERTIFICATE-----\n" +
                    "-----BEGIN CERTIFICATE-----\n" +
                    "MIIE4jCCAsqgAwIBAgIIYsSr5bKAMl8wDQYJKoZIhvcNAQELBQAwejELMAkGA1UEBhMCQ04xFjAU\n" +
                    "BgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmljYXRpb24gQXV0aG9yaXR5MTEw\n" +
                    "LwYDVQQDDChBbnQgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFIxMB4XDTE4MDMy\n" +
                    "MjE0MzQxNVoXDTM3MTEyNjE0MzQxNVowgYIxCzAJBgNVBAYTAkNOMRYwFAYDVQQKDA1BbnQgRmlu\n" +
                    "YW5jaWFsMSAwHgYDVQQLDBdDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTE5MDcGA1UEAwwwQW50IEZp\n" +
                    "bmFuY2lhbCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBDbGFzcyAyIFIxMIIBIjANBgkqhkiG9w0B\n" +
                    "AQEFAAOCAQ8AMIIBCgKCAQEAsLMfYaoRoPRbmDcAfXPCmKf43pWRN5yTXa/KJWO0l+mrgQvs89bA\n" +
                    "NEvbDUxlkGwycwtwi5DgBuBgVhLliXu+R9CYgr2dXs8D8Hx/gsggDcyGPLmVrDOnL+dyeauheARZ\n" +
                    "fA3du60fwEwwbGcVIpIxPa/4n3IS/ElxQa6DNgqxh8J9Xwh7qMGl0JK9+bALuxf7B541Gr4p0WEN\n" +
                    "G8fhgjBV4w4ut9eQLOoa1eddOUSZcy46Z7allwowwgt7b5VFfx/P1iKJ3LzBMgkCK7GZ2kiLrL7R\n" +
                    "iqV+h482J7hkJD+ardoc6LnrHO/hIZymDxok+VH9fVeUdQa29IZKrIDVj65THQIDAQABo2MwYTAf\n" +
                    "BgNVHSMEGDAWgBRfdLQEwE8HWurlsdsio4dBspzhATAdBgNVHQ4EFgQUSqHkYINtUSAtDPnS8Xoy\n" +
                    "oP9p7qEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIB\n" +
                    "AIQ8TzFy4bVIVb8+WhHKCkKNPcJe2EZuIcqvRoi727lZTJOfYy/JzLtckyZYfEI8J0lasZ29wkTt\n" +
                    "a1IjSo+a6XdhudU4ONVBrL70U8Kzntplw/6TBNbLFpp7taRALjUgbCOk4EoBMbeCL0GiYYsTS0mw\n" +
                    "7xdySzmGQku4GTyqutIGPQwKxSj9iSFw1FCZqr4VP4tyXzMUgc52SzagA6i7AyLedd3tbS6lnR5B\n" +
                    "L+W9Kx9hwT8L7WANAxQzv/jGldeuSLN8bsTxlOYlsdjmIGu/C9OWblPYGpjQQIRyvs4Cc/mNhrh+\n" +
                    "14EQgwuemIIFDLOgcD+iISoN8CqegelNcJndFw1PDN6LkVoiHz9p7jzsge8RKay/QW6C03KNDpWZ\n" +
                    "EUCgCUdfHfo8xKeR+LL1cfn24HKJmZt8L/aeRZwZ1jwePXFRVtiXELvgJuM/tJDIFj2KD337iV64\n" +
                    "fWcKQ/ydDVGqfDZAdcU4hQdsrPWENwPTQPfVPq2NNLMyIH9+WKx9Ed6/WzeZmIy5ZWpX1TtTolo6\n" +
                    "OJXQFeItMAjHxW/ZSZTok5IS3FuRhExturaInnzjYpx50a6kS34c5+c8hYq7sAtZ/CNLZmBnBCFD\n" +
                    "aMQqT8xFZJ5uolUaSeXxg7JFY1QsYp5RKvj4SjFwCGKJ2+hPPe9UyyltxOidNtxjaknOCeBHytOr\n" +
                    "-----END CERTIFICATE-----\n");

            // 支付宝根证书
            certAlipayRequest.setRootCertContent("-----BEGIN CERTIFICATE-----\n" +
                    "MIIBszCCAVegAwIBAgIIaeL+wBcKxnswDAYIKoEcz1UBg3UFADAuMQswCQYDVQQG\n" +
                    "EwJDTjEOMAwGA1UECgwFTlJDQUMxDzANBgNVBAMMBlJPT1RDQTAeFw0xMjA3MTQw\n" +
                    "MzExNTlaFw00MjA3MDcwMzExNTlaMC4xCzAJBgNVBAYTAkNOMQ4wDAYDVQQKDAVO\n" +
                    "UkNBQzEPMA0GA1UEAwwGUk9PVENBMFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE\n" +
                    "MPCca6pmgcchsTf2UnBeL9rtp4nw+itk1Kzrmbnqo05lUwkwlWK+4OIrtFdAqnRT\n" +
                    "V7Q9v1htkv42TsIutzd126NdMFswHwYDVR0jBBgwFoAUTDKxl9kzG8SmBcHG5Yti\n" +
                    "W/CXdlgwDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFEwysZfZ\n" +
                    "MxvEpgXBxuWLYlvwl3ZYMAwGCCqBHM9VAYN1BQADSAAwRQIgG1bSLeOXp3oB8H7b\n" +
                    "53W+CKOPl2PknmWEq/lMhtn25HkCIQDaHDgWxWFtnCrBjH16/W3Ezn7/U/Vjo5xI\n" +
                    "pDoiVhsLwg==\n" +
                    "-----END CERTIFICATE-----\n" +
                    "\n" +
                    "-----BEGIN CERTIFICATE-----\n" +
                    "MIIF0zCCA7ugAwIBAgIIH8+hjWpIDREwDQYJKoZIhvcNAQELBQAwejELMAkGA1UE\n" +
                    "BhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNVBAsMF0NlcnRpZmlj\n" +
                    "YXRpb24gQXV0aG9yaXR5MTEwLwYDVQQDDChBbnQgRmluYW5jaWFsIENlcnRpZmlj\n" +
                    "YXRpb24gQXV0aG9yaXR5IFIxMB4XDTE4MDMyMTEzNDg0MFoXDTM4MDIyODEzNDg0\n" +
                    "MFowejELMAkGA1UEBhMCQ04xFjAUBgNVBAoMDUFudCBGaW5hbmNpYWwxIDAeBgNV\n" +
                    "BAsMF0NlcnRpZmljYXRpb24gQXV0aG9yaXR5MTEwLwYDVQQDDChBbnQgRmluYW5j\n" +
                    "aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFIxMIICIjANBgkqhkiG9w0BAQEF\n" +
                    "AAOCAg8AMIICCgKCAgEAtytTRcBNuur5h8xuxnlKJetT65cHGemGi8oD+beHFPTk\n" +
                    "rUTlFt9Xn7fAVGo6QSsPb9uGLpUFGEdGmbsQ2q9cV4P89qkH04VzIPwT7AywJdt2\n" +
                    "xAvMs+MgHFJzOYfL1QkdOOVO7NwKxH8IvlQgFabWomWk2Ei9WfUyxFjVO1LVh0Bp\n" +
                    "dRBeWLMkdudx0tl3+21t1apnReFNQ5nfX29xeSxIhesaMHDZFViO/DXDNW2BcTs6\n" +
                    "vSWKyJ4YIIIzStumD8K1xMsoaZBMDxg4itjWFaKRgNuPiIn4kjDY3kC66Sl/6yTl\n" +
                    "YUz8AybbEsICZzssdZh7jcNb1VRfk79lgAprm/Ktl+mgrU1gaMGP1OE25JCbqli1\n" +
                    "Pbw/BpPynyP9+XulE+2mxFwTYhKAwpDIDKuYsFUXuo8t261pCovI1CXFzAQM2w7H\n" +
                    "DtA2nOXSW6q0jGDJ5+WauH+K8ZSvA6x4sFo4u0KNCx0ROTBpLif6GTngqo3sj+98\n" +
                    "SZiMNLFMQoQkjkdN5Q5g9N6CFZPVZ6QpO0JcIc7S1le/g9z5iBKnifrKxy0TQjtG\n" +
                    "PsDwc8ubPnRm/F82RReCoyNyx63indpgFfhN7+KxUIQ9cOwwTvemmor0A+ZQamRe\n" +
                    "9LMuiEfEaWUDK+6O0Gl8lO571uI5onYdN1VIgOmwFbe+D8TcuzVjIZ/zvHrAGUcC\n" +
                    "AwEAAaNdMFswCwYDVR0PBAQDAgEGMAwGA1UdEwQFMAMBAf8wHQYDVR0OBBYEFF90\n" +
                    "tATATwda6uWx2yKjh0GynOEBMB8GA1UdIwQYMBaAFF90tATATwda6uWx2yKjh0Gy\n" +
                    "nOEBMA0GCSqGSIb3DQEBCwUAA4ICAQCVYaOtqOLIpsrEikE5lb+UARNSFJg6tpkf\n" +
                    "tJ2U8QF/DejemEHx5IClQu6ajxjtu0Aie4/3UnIXop8nH/Q57l+Wyt9T7N2WPiNq\n" +
                    "JSlYKYbJpPF8LXbuKYG3BTFTdOVFIeRe2NUyYh/xs6bXGr4WKTXb3qBmzR02FSy3\n" +
                    "IODQw5Q6zpXj8prYqFHYsOvGCEc1CwJaSaYwRhTkFedJUxiyhyB5GQwoFfExCVHW\n" +
                    "05ZFCAVYFldCJvUzfzrWubN6wX0DD2dwultgmldOn/W/n8at52mpPNvIdbZb2F41\n" +
                    "T0YZeoWnCJrYXjq/32oc1cmifIHqySnyMnavi75DxPCdZsCOpSAT4j4lAQRGsfgI\n" +
                    "kkLPGQieMfNNkMCKh7qjwdXAVtdqhf0RVtFILH3OyEodlk1HYXqX5iE5wlaKzDop\n" +
                    "PKwf2Q3BErq1xChYGGVS+dEvyXc/2nIBlt7uLWKp4XFjqekKbaGaLJdjYP5b2s7N\n" +
                    "1dM0MXQ/f8XoXKBkJNzEiM3hfsU6DOREgMc1DIsFKxfuMwX3EkVQM1If8ghb6x5Y\n" +
                    "jXayv+NLbidOSzk4vl5QwngO/JYFMkoc6i9LNwEaEtR9PhnrdubxmrtM+RjfBm02\n" +
                    "77q3dSWFESFQ4QxYWew4pHE0DpWbWy/iMIKQ6UZ5RLvB8GEcgt8ON7BBJeMc+Dyi\n" +
                    "kT9qhqn+lw==\n" +
                    "-----END CERTIFICATE-----\n" +
                    "\n" +
                    "-----BEGIN CERTIFICATE-----\n" +
                    "MIICiDCCAgygAwIBAgIIQX76UsB/30owDAYIKoZIzj0EAwMFADB6MQswCQYDVQQG\n" +
                    "EwJDTjEWMBQGA1UECgwNQW50IEZpbmFuY2lhbDEgMB4GA1UECwwXQ2VydGlmaWNh\n" +
                    "dGlvbiBBdXRob3JpdHkxMTAvBgNVBAMMKEFudCBGaW5hbmNpYWwgQ2VydGlmaWNh\n" +
                    "dGlvbiBBdXRob3JpdHkgRTEwHhcNMTkwNDI4MTYyMDQ0WhcNNDkwNDIwMTYyMDQ0\n" +
                    "WjB6MQswCQYDVQQGEwJDTjEWMBQGA1UECgwNQW50IEZpbmFuY2lhbDEgMB4GA1UE\n" +
                    "CwwXQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxMTAvBgNVBAMMKEFudCBGaW5hbmNp\n" +
                    "YWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgRTEwdjAQBgcqhkjOPQIBBgUrgQQA\n" +
                    "IgNiAASCCRa94QI0vR5Up9Yr9HEupz6hSoyjySYqo7v837KnmjveUIUNiuC9pWAU\n" +
                    "WP3jwLX3HkzeiNdeg22a0IZPoSUCpasufiLAnfXh6NInLiWBrjLJXDSGaY7vaokt\n" +
                    "rpZvAdmjXTBbMAsGA1UdDwQEAwIBBjAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBRZ\n" +
                    "4ZTgDpksHL2qcpkFkxD2zVd16TAfBgNVHSMEGDAWgBRZ4ZTgDpksHL2qcpkFkxD2\n" +
                    "zVd16TAMBggqhkjOPQQDAwUAA2gAMGUCMQD4IoqT2hTUn0jt7oXLdMJ8q4vLp6sg\n" +
                    "wHfPiOr9gxreb+e6Oidwd2LDnC4OUqCWiF8CMAzwKs4SnDJYcMLf2vpkbuVE4dTH\n" +
                    "Rglz+HGcTLWsFs4KxLsq7MuU+vJTBUeDJeDjdA==\n" +
                    "-----END CERTIFICATE-----\n" +
                    "\n" +
                    "-----BEGIN CERTIFICATE-----\n" +
                    "MIIDxTCCAq2gAwIBAgIUEMdk6dVgOEIS2cCP0Q43P90Ps5YwDQYJKoZIhvcNAQEF\n" +
                    "BQAwajELMAkGA1UEBhMCQ04xEzARBgNVBAoMCmlUcnVzQ2hpbmExHDAaBgNVBAsM\n" +
                    "E0NoaW5hIFRydXN0IE5ldHdvcmsxKDAmBgNVBAMMH2lUcnVzQ2hpbmEgQ2xhc3Mg\n" +
                    "MiBSb290IENBIC0gRzMwHhcNMTMwNDE4MDkzNjU2WhcNMzMwNDE4MDkzNjU2WjBq\n" +
                    "MQswCQYDVQQGEwJDTjETMBEGA1UECgwKaVRydXNDaGluYTEcMBoGA1UECwwTQ2hp\n" +
                    "bmEgVHJ1c3QgTmV0d29yazEoMCYGA1UEAwwfaVRydXNDaGluYSBDbGFzcyAyIFJv\n" +
                    "b3QgQ0EgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOPPShpV\n" +
                    "nJbMqqCw6Bz1kehnoPst9pkr0V9idOwU2oyS47/HjJXk9Rd5a9xfwkPO88trUpz5\n" +
                    "4GmmwspDXjVFu9L0eFaRuH3KMha1Ak01citbF7cQLJlS7XI+tpkTGHEY5pt3EsQg\n" +
                    "wykfZl/A1jrnSkspMS997r2Gim54cwz+mTMgDRhZsKK/lbOeBPpWtcFizjXYCqhw\n" +
                    "WktvQfZBYi6o4sHCshnOswi4yV1p+LuFcQ2ciYdWvULh1eZhLxHbGXyznYHi0dGN\n" +
                    "z+I9H8aXxqAQfHVhbdHNzi77hCxFjOy+hHrGsyzjrd2swVQ2iUWP8BfEQqGLqM1g\n" +
                    "KgWKYfcTGdbPB1MCAwEAAaNjMGEwHQYDVR0OBBYEFG/oAMxTVe7y0+408CTAK8hA\n" +
                    "uTyRMB8GA1UdIwQYMBaAFG/oAMxTVe7y0+408CTAK8hAuTyRMA8GA1UdEwEB/wQF\n" +
                    "MAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBLnUTfW7hp\n" +
                    "emMbuUGCk7RBswzOT83bDM6824EkUnf+X0iKS95SUNGeeSWK2o/3ALJo5hi7GZr3\n" +
                    "U8eLaWAcYizfO99UXMRBPw5PRR+gXGEronGUugLpxsjuynoLQu8GQAeysSXKbN1I\n" +
                    "UugDo9u8igJORYA+5ms0s5sCUySqbQ2R5z/GoceyI9LdxIVa1RjVX8pYOj8JFwtn\n" +
                    "DJN3ftSFvNMYwRuILKuqUYSHc2GPYiHVflDh5nDymCMOQFcFG3WsEuB+EYQPFgIU\n" +
                    "1DHmdZcz7Llx8UOZXX2JupWCYzK1XhJb+r4hK5ncf/w8qGtYlmyJpxk3hr1TfUJX\n" +
                    "Yf4Zr0fJsGuv\n" +
                    "-----END CERTIFICATE-----");

            return new DefaultAlipayClient(certAlipayRequest);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * 获得初始化的AlipayClient 公钥不带证书模式
     */
    @Bean
    public AlipayClient alipayClientKey() {
        // 获得初始化的AlipayClient 公钥模式不带证书
        return new DefaultAlipayClient(serverUrl, appId, privateKey,
                AlipayConstants.FORMAT_JSON, AlipayConstants.CHARSET_UTF8,
                publicKey, AlipayConstants.SIGN_TYPE_RSA2);
    }

}

